<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2016/10/12
 * Time: 15:48
 * Project name: PHPTEST
 * File name: 1.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since
 */

/* 假设这个页面的访问路径是: http://example.com/operator.php */

class Operator {

    /**
     * Add two operands
     * @param interge
     * @return interge
     * @since
     */
    public function add($a, $b) {
        return $this->_add($a, $b);
    }

    /**
     * @param $a
     * @param $b
     *
     * @return mixed
     *
     * @since version
     */
    public function sub($a, $b) {
        return $a - $b;
    }

    /**
     * @param $a
     * @param $b
     *
     * @return mixed
     *
     * @since version
     */
    public function mul($a, $b) {
        return $a * $b;
    }

    /**
     * @param int $a
     * @param int $b
     *
     * @return int
     *
     * @since version
     */
    protected function _add(int $a, int $b) {
        return $a + $b;
    }
}

$server = new Yar_Server(new Operator());
$server->handle();
